from django.urls import path
from .views import *

urlpatterns = [
    # Api相关接口地址
    path(
        "apiInfo/", ApiInfoView.as_view({"get": "page", "post": "add", })
    ),
    path("apiInfo/list/", ApiInfoView.as_view({"get": "list"})),
    path("apiInfo/page/", ApiInfoView.as_view({"get": "page"})),
    path("apiInfo/update/", ApiInfoView.as_view({"post": "update"})),
    path("apiInfo/debug/", ApiInfoView.as_view({"post": "debug"})),
    path("apiInfo/stepSyn/<int:pk>", ApiInfoView.as_view({"post": "step_syn"})),
    path("apiInfo/addRequestHeaderList/",
         ApiInfoAddRequestHeaderListView.as_view({"post": "api_info_add_request_header_list"})),
    path("apiInfo/uploadByUrl/", ApiInfoView.as_view({"post": "upload_by_url"})),
    path("apiInfo/upload/", FileUploadViewSet.as_view({"post": "upload_file"})),
    path("apiInfo/<int:pk>/", ApiInfoView.as_view({"get": "details", "delete": "delete"})),
    # ApiSuite相关接口地址
    path("apiSuite/", ApiSuiteView.as_view({"get": "list", "post": "add", })),
    path("apiSuite/tree/<int:project_id>/", ApiSuiteView.as_view({"get": "api_suite_tree", })),
    # TestCase相关接口地址
    path("testCase/", TestCaseView.as_view({"post": "add", })),
    path("testCase/delete/<int:pk>/", TestCaseView.as_view({"delete": "delete", })),
    path("testCase/page/", TestCaseView.as_view({"get": "page"})),
    path("testCase/run/", TestCaseView.as_view({"post": "run"})),
    # TestCaseStep相关接口地址
    path("testCaseStep/", TestCaseStepView.as_view({"post": "add"})),
    path("testCaseStep/list/", TestCaseStepReqView.as_view({"get": "list"})),
    path("testCaseStep/updateOne/", TestCaseStepReqView.as_view({"post": "update_one"})),
    path("testCaseStep/deleteOne/<int:pk>/", TestCaseStepReqView.as_view({"delete": "delete_one"})),
    path("testCaseStep/updateSort/", TestCaseStepReqView.as_view({"post": "update_sort"})),
    # TestCaseGroup相关接口地址
    path("testCaseGroup/", TestCaseGroupView.as_view({"post": "add", "get": "list"})),
    path("testCaseGroup/addCaseToGroup/", TestCaseGroupCreateUpdateView.as_view({"post": "add"})),
    path("testCaseGroup/deleteCaseFromGroup/", TestCaseGroupCreateUpdateView.as_view({"post": "delete"})),
    path("testCaseGroup/caseList/", TestCaseGroupCaseListView.as_view({"get": "case_list"})),
    path("testCaseGroup/run/<int:test_case_group_id>/<int:env_id>/", TestCaseGroupView.as_view({"post": "run"})),

]
